import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      "@":path.resolve(__dirname, 'src')
    }
  },
  server: {
    port: 4000,
    host: "0.0.0.0",
    open: true,
    proxy: {
      // 使用 proxy 实例
      '/api': {
        target: 'http://localhost:9090',
        changeOrigin: true, //是否跨域
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    },
  },
})
